Skip to main content

API Reference

allxon_infrasturcture

Glossary of Terms

TermDescription
Allxon CloudThe backend servers of Allxon service; both Allxon Portal and Allxon Agent are connected to Allxon Cloud.
Allxon PortalThe frontend servers of Allxon service.
Allxon AgentAn agent application that communicates between edge devices and Allxon Cloud.
PluginA software application that extends the functionalities of Allxon service. A plugin sends collected data from modules to Allxon Cloud via Allxon Agent. It also sends commands from Allxon Portal to modules via Allxon Agent.
ModuleA hardware component (e.g. GPU, SSD, fan) or a software application (e.g. remote console utilities). A plugin collects data from a module or sends commands to a module.
MQTT BrokerAllxon Agent connects to a MQTT broker hosted by Allxon Cloud. All the data exchange between Allxon Agents and Allxon Cloud go through this channel.
WebSocket ServerA plugin connects to a WebSocket server hosted within an Allxon Agent. The plugin sends and receives data to/from Allxon Cloud with Allxon Octo APIs through this channel.
Allxon Octo APIThe Application Programming Interface used to communicate between Allxon Agent and plugins.
Allxon Octo SDKThe Software Development Kit provided by Allxon, which helps developers to build plugins and verify Allxon Octo APIs.
App GUIDA unique identifier assigned by Allxon to each plugin in UUIDv4 format.
Access KeyA secret key assigned by Allxon to each plugin for message signing.

Allxon Octo API

Allxon Octo API adopts JSON-RPC 2.0 specification over WebSocket. To communicate with Allxon Agent, you need to create a WebSocket connection wss://localhost:55688 from the plugin. Then send/receive requests in the JSON format via the API.

note

Each API maximum payload size is 5 KB.

note

JSON-RPC batch is not supported.

How to Read the API

  • If the API name starts with notify..., it's a JSON-RPC Notification Request.
  • A bracketed JSON Key represents a JSON Type. The types are as follows: Object, Array, String, Number, Bool, Null
  • If a JSON Key is not bracketed, the JSON Type is String.

"v2/notifyPluginUpdate"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginUpdate",
"params": {
"appGUID": "...",
"epoch": "...",
"appName": "...",
"displayName": "...",
"type": "...",
"sdk": "...",
"version": "...",
"startCommand": "...",
"stopCommand": "...",
"modules": [
{
"moduleName": "...",
"displayName": "...",
"description": "...",
"properties": [ ... ],
"states": [ ... ],
"metrics": [ ... ],
"events": [ ... ],
"commands": [ ... ],
"alarms": [ ... ],
"configs": [ ... ]
}
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"appName"StringcheckThe unique plugin name in string format. The name must match the regular expression1.
"epoch"StringcheckThe current Epoch Time in seconds.
"displayName"StringThe plugin name displayed on the plugIN card.
"type"Stringcheck"ib" for in-band plugin.
"oob" for out-of-band plugin.
"sdk"StringcheckThe version of Allxon Octo SDK, which follows semantic version rule.
"version"StringcheckThe version of a plugin, which uses a sequence of three digits (Major.Minor.Patch). It must match the regular expression2.
"startCommand"StringA Command to execute when plugin starts.
"stopCommand"StringA Command to execute when plugin stops.
"modules"ArraycheckA set of hardware or software modules controlled by this plugin.

$.params.modules[*]

NameTypeRequiredDescription
"moduleName"StringcheckThe module name unique within the plugin and having a string format of no longer than 64 characters. The name must match the regular expression.
"displayName"StringThe module name displayed on the plugin tab of the device page.
"description"StringThe description of the module.
"properties"ArrayThis is used to upload the static information of the module, such as the firmware version and hardware configuration.
"states"ArrayThis is used to upload the dynamic states of the module, such as the power state.
"metrics"ArrayThis is used to upload metrics of the module, such as temperature and voltage.
"events"ArrayThis is used to upload events/activities of the module, such as intrusion detection.
"commands"ArrayThis is used to enable function calls of the module, such as power cycling and hardware configuration.
"alarms"ArrayThis is used to handle alerts of the module, such as alerts for CPU and system temperature.
"configs"ArrayThis is used to handle the remote configurations of the module, such as scheduling.

$.params.modules[*].properties[*]

{
"name": "...",
"displayName": "...",
"displayCategory": "...",
"description": "...",
"displayType": "...",
"value": "..."
}
NameTypeRequiredDescription
"name"StringcheckThe property name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe display name of each property field.
"displayCategory"StringThe name of the Category tab displayed on a card. Properties with the same displayCategory are categorized under the same tab.
"description"StringThe description of the property.
"displayType"Stringcheck"string" | "table" | "link"
"value"Object | Array | StringcheckThe type of "value" depends on the "displayType".

"displayType":"string" in "properties"

In Properties, if the "displayType" is set to "string", the type of "value" must be String.

Here is an example:

v2/notifyPluginUpdate.json
{
...
"properties": [
{
"name": "property1",
"displayType": "string",
"value": "my string",
...
},
...
]
}

The Properties card displays as follows:

property-display-type-string

If the "displayType" is set to link, the type of "value" must be Object and must follow the format below.

NameTypeRequiredDescription
"url"StringcheckA link to an external resource.
"alias"StringAn alias name for this URL.

Here is an example:

v2/notifyPluginUpdate.json
{
...
"properties": [
{
"name": "property1",
"displayType": "link",
"value": {
"url": "https://www.google.com",
"alias": "Google Site"
},
...
},
...
]
}

The Properties card displays as follows:

property-display-type-link

"displayType":"table" in "properties"

When the "displayType" is set to table, the type of "value" must be Array.

Here is an example:

v2/notifyPluginUpdate.json
{
...
"properties": [
{
"name": "property1",
"displayType": "table",
"value": [
{
"header1": "row1 column1",
"header2": "row1 column2"
},
{
"header1": "row2 column2",
"header2": "row2 column2"
},
...
],
...
},
...
]
}

The Properties card displays as follows:

property-display-type-table

Click the table icon to view details. property-display-type-table-popup

$.params.modules[*].states[*]

{
"name": "...",
"displayName": "...",
"displayCategory": "...",
"description": "...",
"displayType": "..."
}
NameTypeRequiredDescription
"name"StringcheckThe state name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe field name displayed under the state.
"displayCategory"StringThe name of the Category tab displayed on a card. States with the same displayCategory are categorized under the same tab.
"description"StringThe description of the state.
"displayType"Stringcheck"string" | "table" | "link"

$.params.modules[*].metrics[*]

{
"name": "...",
"displayName": "...",
"displayCategory": "...",
"description": "...",
"displayUnit": "...",
"displayType": "..."
}
NameTypeRequiredDescription
"name"StringcheckThe name of the set of metrics, which is unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.1.
"displayName"StringThe field name displayed under the metrics.
"displayCategory"StringThe name of the Category tab displayed on a card. Metrics with the same displayCategory are categorized under the same tab.
"description"StringThe description of the metric.
"displayUnit"StringDepending on "displayType"If the "displayType" is "custom", the display unit should be entered.
"displayType"Stringcheck"temperature" | "custom"

$.params.modules[*].events[*]

{
"name": "...",
"displayName": "...",
"displayCategory": "...",
"description": "..."
}
NameTypeRequiredDescription
"name"StringcheckThe event name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe field name displayed under the event
"displayCategory"StringThe name of the Category tab displayed within a card. Events with the same displayCategory are categorized under the same tab.
"description"StringThe description of the event.

$.params.modules[*].commands[*]

{
"name": "...",
"displayCategory": "...",
"displayName": "...",
"description": "...",
"type": "...",
"params": [
{
"name": "...",
"displayName": "...",
"description": "...",
"displayType": "...",
"required": true | false,
"requiredOn": "...",
"defaultValue": "...",
"displayMask": "...",
"valueEncoding": "..."
}, ...
]
}
NameTypeRequiredDescription
"name"StringcheckThe command name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayCategory"StringThe name of the Category tab displayed on a card. Commands with the same displayCategory are categorized under the same tab.
"displayName"StringThe field name under the command.
"description"StringThe description of the command.
"type"Stringcheck"asynchronous"
"displayOnProperty"Object(This function is only used in special scenarios. Contact your Allxon representative for instructions.)
"params"Array(No need to set this item if this command has no parameters.)

$.params.modules[*].commands[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe command parameter name unique within the command and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe field name under the command parameter.
"description"StringThe description of the command parameter.
"displayType"Stringcheck"string" | "text" | "datetime" | "switch" | "checkbox" | "list" | "tos"
"required"BoolcheckIndicates if this parameter is mandatory or not.
"requiredOn"StringIndicates if this parameter is mandatory on the other parameter.
"displayValues"String | ArrayRelated to the "displayType".
"defaultValue"StringThe default value of this parameter.
"displayFormat"StringDepending on "displayType"A property for the "datetime" displayType. Refer to the datetime format.
"valueFromProperty"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.)
"displayMask"Bool(Not implemented in the Portal yet.)
"valueEncoding"StringAdvance

$.params.modules[*].alarms[*]

{
"name": "...",
"displayCategory": "...",
"displayName": "...",
"description": "...",
"params": [
{
"name": "...",
"displayName": "...",
"description": "...",
"displayType": "...",
"required": true | false,
"displayValues": "...",
"defaultValue": "...",
"displayFormat": "...",
"valueFromProperty": "...",
"displayMask": "...",
"valueEncoding": "..."
}, ...
]
}
NameTypeRequiredDescription
"name"StringcheckThe alarm name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayCategory"StringThe name of the category tab displayed on a card.Alarms with the same displayCategory are categorized under the same tab.
"displayName"StringThe field name displayed under the alarm.
"description"StringThe description of the alarm.
"params"Array(No need to set this item if this alarm has no parameters.)

$.params.modules[*].alarms[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe parameter name unique within the alarm and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe field name displayed under the alarm parameter.
"description"StringThe description of the alarm parameter.
"displayType"Stringcheck"string" | "datetime" | "switch" | "checkbox" | "list" | "temperature"
"required"BoolcheckIndicates if this parameter is mandatory or not.
"displayValues"StringRelated to the "displayType".
"defaultValue"StringThe default value of this parameter.
"displayFormat"StringDepending on "displayType"A required property if the displayType is "datetime". Refer to the datetime format.
"valueFromProperty"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.)
"displayMask"BoolA property for the "string" displayType, indicating if the string inputs are masked or not.
"valueEncoding"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.)

$.params.modules[*].configs[*]

{
"name": "...",
"displayCategory": "...",
"displayName": "...",
"description": "...",
"params": [
{
"name": "...",
"displayName": "...",
"description": "...",
"displayType": "...",
"required": true | false,
"displayValues": "...",
"defaultValue": "...",
"displayFormat": "...",
"valueFromProperty": "...",
"displayMask": "...",
"valueEncoding": "..."
}, ...
]
}
NameTypeRequiredDescription
"name"StringcheckThe config name unique within the module and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayCategory"StringThe name of the category tab displayed on a card. Configs with the same displayCategory are categorized under the same tab.
"displayName"StringTThe field name displayed under the config.
"description"StringThe description of the config.
"params"Array(No need to set this item if this config has no parameters.)

$.params.modules[*].configs[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe command parameter name unique within the config and having a string format of no longer than 32 characters. The name must match the regular expression1.
"displayName"StringThe field name under the config parameter.
"description"StringThe description of the config parameter.
"displayType"Stringcheck"string" | "datetime" | "switch" | "checkbox" | "list" | "temperature"
"required"BoolcheckIndicates if this parameter is mandatory or not.
"displayValues"StringRelated to the "displayType"
"defaultValue"StringDefault value of this parameter.
"displayFormat"StringDepending on "displayType"A property for the "datetime" displayType. Refer to the datetime format.
"valueFromProperty"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.)
"displayMask"BoolA property for the "string" displayType, indicating if the string inputs are masked or not.
"valueEncoding"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.)

"v2/notifyPluginCommand"

Direction: Agent → Plugin

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginCommand",
"params": {
"serialNumber": "...",
"appGUID": "...",
"epoch": "...",
"commandId": "...",
"commandSource": "...",
"moduleName": "...",
"commands": [ ... ]
}
}

$.params

NameTypeRequiredDescription
"serialNumber"String(This function is only used in special scenarios. Contact your Allxon representative for instructions.) The serial number of the device behind a gateway, only required when sending commands to devices behind a gateway.
"appGUID"StringcheckThe GUID of the plugin.
"epoch"StringcheckThe current Epoch Time in seconds.
"commandId"StringcheckThe assistId in MQTT message.
"commandSource"Stringcheck"remote"
"moduleName"StringcheckThe name of the module. The name must match the regular expression1.
"commands"ArraycheckA set of modules.

$.params.commands[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the command. The name must match the regular expression1.
"params"ArrayA set of name and value pairs for the command.

$.params.commands[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the parameter. The name must match the regular expression1.
"value"String | BoolcheckThe type of "value" depends on the "displayType" in the command parameter part of "v2/notifyPluginUpdate". More details....

"displayType":"string" in "commands"

Based on the "displayType":"string" defined in "v2/notifyPluginUpdate", the Commands card displays a text box for the user to enter a string parameter.

command-display-type-string

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "stringParam",
"displayType": "string",
"required": false,
...
}
],
...
}
],
}

With this setting, the user can enter a string parameter, such as "foo" in the example below, and execute the command. command-display-type-string-exec

Then "v2/notifyPluginCommand" is sent out, carrying the command of "value": "foo".

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "stringParam",
"value": "foo"
}
]
}
]
}

"displayType":"datetime" in "commands"

If "v2/notifyPluginUpdate" has "displayType":"datetime", you must define "displayFormat" by using one of the following formats:

  • "YYYY-MM-DD"
  • "HH:MM"
  • "YYYY-MM-DD HH:MM"

Then the Commands card on the Portal displays a corresponding field. Here is an example showing the field with "displayFormat" being "HH:MM"

command-display-type-date

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "dateParam",
"displayType": "datetime",
"required": false,
"displayFormat": "HH:MM",
...
}
],
...
}
],
}

When the user selects a time, for example “12:00”, and executes the command, "v2/notifyPluginCommand" is sent out. The value in the command follows the format of "displayFormat": "HH:MM"

command-display-type-date-selected

See the JSON example below:

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "dateParam",
"value": "12:00"
}
]
}
]
}

"displayType":"text" in "commands"

If you set "displayType" to "text" in "v2/notifyPluginUpdate", the "value" in the command can contain multiple lines of parameters. The Commands card on the Portal displays a text parameter field.

command-display-type-text

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "textParam",
"displayType": "text",
"required": false,
...
}
],
...
}
],
}

Here is an example of how this works:

The user enters “hello world” in two lines and executes the command.

command-display-type-text-typed

This sends out "v2/notifyPluginCommand" with "value":"hello\nworld".

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "dateParam",
"value": "hello\nworld"
}
]
}
]
}

"displayType":"switch" in "commands"

The switch function is used to switch between two parameters. The Commands card displays a toggle button for the user to make the change, as shown below.

command-display-type-switch

If you set "displayType" to "switch" in "v2/notifyPluginUpdate", you must define "displayValues" as a size 2 Array, with index 0 representing false and index 1 representing true.

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "switchParam",
"displayType": "switch",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user executes the command, "v2/notifyPluginCommand" is sent out. The value in the command follows the "displayValues" defined in "v2/notifyPluginUpdate".

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "switchParam",
"value": "offValue"
}
]
}
]
}

"displayType":"checkbox" in "commands"

The Commands card displays a checkbox for the user to enable or disable this parameter.

command-display-type-checkbox

If you set "displayType" to "checkbox" in "v2/notifyPluginUpdate", you must define "displayValues" as a size 2 Array, with index 0 representing false and index 1 representing true.

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "checkboxParam",
"displayType": "checkbox",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user executes the command, "v2/notifyPluginCommand" is sent out. The value in the command follows the "displayValue" defined in "v2/notifyPluginUpdate".

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "checkboxParam",
"value": "offValue"
}
]
}
]
}

"displayType":"list" in "commands"

The list function enables the user to select a parameter from a dropdown menu.

command-display-type-list

If you set "displayType" to "list" in "v2/notifyPluginUpdate", you must define "displayValues" as the "Array" type.

See the JSON example below.

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "listParam",
"displayType": "list",
"displayValues": [
"list1",
"list2"
],
"required": false
...
}
],
...
}
],
}

After the user executes the command, "v2/notifyPluginCommand" is sent out. The value in the command follows the "displayValues" defined in "v2/notifyPluginUpdate".

command-display-type-list-selected

See the JSON example below.

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "listParam",
"value": "list1"
}
]
}
]
}

"displayType":"tos" in "commands"

"tos" stands for Terms of Service. Use this "displayType" if a command requires the user to agree to the Terms of Service before command execution. With this setting, the user agreement is mandatory on the Portal before the user can click the Execute button.

command-display-type-tos

If you set "displayType" to "tos" in "v2/notifyPluginUpdate", you must define "displayName" and description. Put your Terms of Service link in description.

See the JSON example below.

v2/notifyPluginUpdate.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "tosParam",
"displayType": "tos",
"displayName": "Terms of Service",
"description": "https://policies.google.com/terms?hl=en-US",
"required": true
...
}
],
...
}
],
}

After the user executes the command, "v2/notifyPluginCommand" is sent out, carrying "value": false.

v2/notifyPluginCommand.json
{
...
"commands": [
{
"name": "command1",
"params": [
{
"name": "tosParam",
"value": false
}
]
}
]
}
caution

The type of "value" is Bool.

"v2/notifyPluginCommandAck"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginCommandAck",
"params": {
"serialNumber": "...",
"appGUID": "...",
"epoch": "...",
"commandId": "...",
"commandSource": "...",
"moduleName": "...",
"commandState": "...",
"commandAcks": [
{
"name": "...",
"result": { ... }
}, ...
],
"states": [
{
"name": "...",
"value": "..."
}, ...
]
}
}

$.params

NameTypeRequiredDescription
"serialNumber"String( This function is only used in special scenarios. Contact your Allxon representative for instructions.) The serial number of the device behind a gateway, only required when you send commands to devices behind a gateway.
"appGUID"StringcheckThe GUID of the plugin.
"epoch"StringcheckThe current Epoch Time in seconds.
"commandId"StringcheckThe same commandId retrieved from "v2/notifyPluginCommand".
"commandSource"StringcheckThe same commandSource retrieved from "v2/notifyPluginCommand".
"moduleName"StringcheckThe same moduleName retrieved from "v2/notifyPluginCommand". The name must match the regular expression1.
"commandState"Stringcheck"ACCEPTED": Plugin reports that a request for command execution is received.
"REJECTED": Plugin reports that the request for command execution is rejected.
"ACKED": Plugin reports that the command execution is completed.
"ERRORED": Plugin reports that the command execution failed.
"commandAcks"Arraycheck
"states"ArrayThe States that you want to update right after executing a command.

$.params.commandAcks[*]

NameTypeRequiredDescription
"name"StringcheckThe same command name retrieved from "v2/notifyPluginCommand".
"result"ObjectThe result of the command, defined by plugin.

$.params.states[*]

NameTypeRequiredDescription
"name"StringcheckThe same command name retrieved from "v2/notifyPluginCommand".
"value"Object | Array | StringcheckThe type of "value" depends on the "displayType" in state part of "v2/notifyPluginUpdate". More details....
"time"StringThe Epoch Time in seconds of the state.

"v2/notifyPluginState"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginState",
"params": {
"appGUID": "...",
"moduleName": "...",
"epoch": "...",
"states": [
{
"name": "...",
"value": "..."
}, ...
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"moduleName"StringcheckThe name of the module. The name must match the regular expression1
"epoch"StringcheckThe current Epoch Time in seconds.
"states"ArraycheckA set of states.

$.params.states[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the state.
"value"Object | Array | StringcheckThe type of "value" depends on the "displayType" in state part of "v2/notifyPluginUpdate". More details...
"time"StringThe current Epoch Time in seconds of the state.

"displayType":"string" in "states"

If "v2/notifyPluginUpdate" uses "displayType": "string", the state value is displayed in the string format.

v2/notifyPluginUpdate.json
{
...
"states": [
{
"name": "stringState",
"displayType": "string",
...
},
...
]
}

state-display-type-string

Accordingly, when "v2/notifyPluginState" is sent to update the state value, The type of "value" must be String.

Example:

v2/notifyPluginState.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginState",
"params": {
"states": [
{
"name": "stringState",
"value": "my state string"
},
...
]
}
}

Then the States card is updated, as shown below.

state-display-type-string-exec

If "v2/notifyPluginUpdate" uses "displayType": "link", the state value is a URL that leads to an external resource.

Example:

v2/notifyPluginUpdate.json
{
...
"states": [
{
"name": "linkState",
"displayType": "link",
...
},
...
]
}

state-display-type-link

Accordingly, when "v2/notifyPluginState" is sent to update the state value, the type of "value" must be Object and follows the format below.

NameTypeRequiredDescription
urlStringcheckA link to an external resource.
aliasStringAn alias name for this URL.

See the JSON example below:

v2/notifyPluginState.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginState",
"params": {
...
"states": [
{
"name": "linkState",
"value": {
"url": "https://www.google.com",
"alias": "Google Site"
}
},
...
]
}
}

Then the States card is updated, as shown below. state-display-type-link-exec

"displayType":"table" in "states"

If "v2/notifyPluginUpdate" uses "displayType": "table", the state value is displayed in a table.

Example:

v2/notifyPluginUpdate.json
{
...
"states": [
{
"name": "tableState",
"displayType": "table",
...
},
...
]
}

state-display-type-table

When "v2/notifyPluginState" is sent to update the state value, the type of "value" must be Array.

See the JSON example below:

v2/notifyPluginState.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginState",
"params": {
...
"states": [
{
"name": "tableState",
"value": [
{
"header1": "row1 column1",
"header2": "row1 column2"
},
{
"header1": "row2 column2",
"header2": "row2 column2"
}
]
}
]
}
}

Then, the States card displays a table icon.

state-display-type-table-exec

Just click the table icon to bring up a window to show the details.

state-display-type-table-popup

"v2/notifyPluginMetric"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginMetric",
"params": {
"appGUID": "...",
"moduleName": "...",
"epoch": "...",
"metrics": [
{
"name": "...",
"value": "..."
}, ...
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"moduleName"StringcheckThe name of the module, The name must match the regular expression1.
"epoch"StringcheckThe current Epoch Time in seconds.
"metrics"ArraycheckA set of metrics.

$.params.metrics[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the metric.
"value"StringcheckThe type of "value" depends on the "displayType" in metric part of "v2/notifyPluginUpdate". The number of value supports up to fifteen digits and two decimal places. Refer to Details.
"time"StringThe Epoch Time in seconds of the metrics.

"displayType":"temperature" in "metrics"

If the "displayType" is set to "temperature", the Portal displays a toggle button for switching between oF/oC (Fahrenheit/ Celsius).

Example:

v2/notifyPluginUpdate.json
{
...
"metrics": [
{
"name": "temperatureMetric",
"displayType": "temperature",
...
},
...
]
}

metric-display-type-temperature

When "v2/notifyPluginMetrics" is sent to update the metric value, the "value" SHOULD be reported in unit of Kelvin.

v2/notifyPluginMetric.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginMetric",
"params": {
...
"metrics": [
{
"name": "temperatureMetric",
"value": "298"
},
...
]
}
}

The Portal converts the metric unit from Kelvin to Fahrenheit and Celsius.

metric-display-type-temperature-exec

"displayType":"custom" in "metrics"

If "displayType" is set to "custom", you must define "displayUnit" as the unit of the metrics.

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"metrics": [
{
"name": "customMetric",
"displayType": "custom",
"displayUnit": "degree",
...
},
...
]
}

metric-display-type-temperature

Use "v2/notifyPluginMetrics" to update the metric value. See the JSON example below:

v2/notifyPluginMetric.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginMetric",
"params": {
...
"metrics": [
{
"name": "customMetric",
"value": "30"
},
...
]
}
}

The Charts card is updated accordingly, as shown below.

metric-display-type-custom-exec

"v2/notifyPluginEvent"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginEvent",
"params": {
"appGUID": "...",
"moduleName": "...",
"epoch": "...",
"events": [
{
"name": "...",
"value": "..."
}, ...
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"moduleName"StringcheckThe name of the module. The name must match the regular expression1
"epoch"StringcheckThe current Epoch Time in seconds.
"events"ArraycheckA set of events

$.params.events[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the event.
"value"StringThe value of the event.
"time"StringThe Epoch Time in seconds of the event.

"v2/notifyPluginConfigUpdate"

Direction: Agent → Plugin

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
"params": {
"appGUID": "...",
"epoch": "...",
"version": "...",
"modules": [
{
"moduleName": "...",
"epoch": "...",
"configs": [
{
"name": "...",
"params": [
{
"name": "...",
"value": "..."
},
...
]
},
...
]
}
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"epoch"StringcheckThe current Epoch Time in seconds.
"version"StringcheckThe version of the plugin config.
"modules"ArraycheckA set of modules.

$.params.modules[*]

NameTypeRequiredDescription
"moduleName"StringcheckThe name of the module. The name must match the regular expression1.
"epoch"StringcheckThe Epoch time in seconds when an update is made. Plugin should update the module’s config based on the latest Epoch time.
"configs"ArraycheckA set of configs.

$.params.modules[*].configs[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the config. The name must match the regular expression1.
"params"ArraycheckA set of name and value pairs for the configs. The maximum total size of the configs is up to 1024 bytes.

$.params.modules[*].configs[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the parameter. The name must match the regular expression1.
"value"StringcheckThe type of "value" depends on the "displayType" in configs part of "v2/notifyPluginUpdate". More details.

"displayType":"string" in "configs"

Based on "displayType": "string" defined in "v2/notifyPluginUpdate", the Configs card displays a text box for the user to enter a string parameter.

config-display-type-string

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "stringParam",
"displayType": "string",
"required": false,
...
},
...
],
...
}
],
}

The user can enter a string parameter, such as “foo” in the example below, and update the parameter on the Configs card.

config-display-type-string-exec

Then "v2/notifyPluginConfigUpdate" is sent out, carrying the config of "value": "foo".

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "stringParam",
"value": "foo"
}
...
]
...
}
...
]
}

"displayType":"datetime" in "configs"

If "v2/notifyPluginUpdate" uses "displayType": "datetime", you must define "displayFormat" using one of the following formats:

  • "YYYY-MM-DD"
  • "HH:MM"
  • "YYYY-MM-DD HH:MM"

See the JSON example below.

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "datetimeParam",
"displayType": "datetime",
"displayFormat": "HH:MM",
"required": false,
...
},
...
],
...
}
],
}

config-display-type-datetime

When the user selects a time, for example "06:00” and executes the command, "v2/notifyPluginConfigUpdate" is sent out. The "value" in the update follows the format of "displayFormat": "HH:MM".

config-display-type-datetime-exec

See the JSON example below:

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "datetimeParam",
"value": "06:00"
}
...
]
...
}
...
]
}

"displayType":"switch" in "configs"

The switch function is used to switch between two parameters. The Configs card displays a toggle switch for the user to make the change, as shown below.

config-display-type-switch

See the JSON example as below.

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "switchParam",
"displayType": "switch",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user updates the config, "v2/notifyPluginConfigUpdate" is sent out. The value in the command follows the "displayValues" defined in "v2/notifyPluginUpdate".

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "switchParam",
"value": "offValue"
}
...
]
...
}
...
]
}

"displayType":"checkbox" in "configs"

The Configs card displays a checkbox for the user to enable or disable the parameter.

config-display-type-checkbox

If you set "displayType" to "checkbox" in "v2/notifyPluginUpdate", you must define "displayValues" as a size 2 Array, with index 0 representing false, index 1 representing true.

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "checkboxParam",
"displayType": "checkbox",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user updates the config, "v2/notifyPluginConfigUpdate" is sent out. The value in the update follows the "displayValues" defined in "v2/notifyPluginUpdate".

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "checkboxParam",
"value": "offValue"
}
...
]
...
}
...
]
}

"displayType":"list" in "configs"

The list function enables the user to select a parameter from a dropdown menu.

config-display-type-list

If you set "displayType" to "list" in "v2/notifyPluginUpdate" , you must define "displayValues" as the Array type.

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "listParam",
"displayType": "list",
"displayValues": [
"list1",
"list2"
],
"defaultValue": "list1",
"required": false,
...
}
],
...
}
],
}

After the user updates the config, "v2/notifyPluginConfigUpdate" is sent out. The value in the update follows the "displayValues" defined in "v2/notifyPluginUpdate".

See the JSON example below:

config-display-type-list-exec

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "listParam",
"value": "list1"
}
...
]
...
}
...
]
}

"displayType":"temperature" in "configs"

If you set "displayType" to "temperature", the user can enter temperature parameters in Fahrenheit or Celsius.

config-display-type-temperature

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "temperatureParam",
"displayType": "temperature",
"required": false,
...
}
],
...
}
],
}

Please note that while the user uses the Fahrenheit or Celsius scale on the Portal, the temperature scale sent to the plugin needs to be Kelvin.

Example:

The user enters “28 oC” on the Configs card. However, v2/notifyPluginConfigUpdate.json shows "value":"301.15".

config-display-type-temperature-exec

v2/notifyPluginConfigUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginConfigUpdate",
...
...
...
"configs": [
{
"name": "config1",
"params": [
{
"name": "temperatureParam",
"value": "301.15"
}
...
]
...
}
...
]
}

"v2/notifyPluginAlarmUpdate"

Direction: Agent → Plugin

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
"params": {
"appGUID": "...",
"epoch": "...",
"version": "...",
"modules": [
{
"moduleName": "...",
"epoch": "...",
"alarms": [
{
"name": "...",
"enabled": true,
"params": [
{
"name": "...",
"value": "..."
},
...
]
},
...
]
}
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"epoch"StringcheckThe current Epoch Time in seconds.
"version"StringcheckThe version of the plugin alarm.
"modules"ArraycheckA set of modules.

$.params.modules[*]

NameTypeRequiredDescription
"moduleName"StringcheckThe name of the module. The name must match the regular expression1.
"epoch"StringcheckThe Epoch time in seconds when an update is made. Plugin should update the module’s alarms based on the latest Epoch time.
"alarms"ArraycheckA set of alarms.

$.params.modules[*].alarms[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the alarm. The name must match the regular expression1.
"enabled"BoolcheckAlarm is enabled.
"params"ArraycheckA set of name and value pairs for the alarm. The maximum total size of the alarm is up to 1024 bytes

$.params.modules[*].alarms[*].params[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the parameter. The name must match the regular expression1.
"value"StringcheckThe type of "value" depends on the "displayType" in alarm part of "v2/notifyPluginUpdate". More details.

"displayType":"string" in "alarms"

Based on "displayType": "string" defined in "v2/notifyPluginUpdate", the Alert Settings card displays a text box for the user to enter a string parameter.

alarm-display-type-string

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "stringParam",
"displayType": "string",
"required": false,
...
},
...
],
...
}
],
}

The user can enter a string parameter, such as "foo” in the example below, and update the parameter on the Alert Settings card.

alarm-display-type-string-exec

Then "v2/notifyPluginAlarmUpdate" is sent out, carrying "value": "foo".

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "stringParam",
"value": "foo"
}
...
]
...
}
...
]
}

"displayType":"datetime" in "alarms"

If "v2/notifyPluginUpdate" uses "displayType": "datetime", you must define "displayFormat" using one of the following formats:

  • "YYYY-MM-DD"
  • "HH:MM"
  • "YYYY-MM-DD HH:MM"

alarm-display-type-datetime

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "datetimeParam",
"displayType": "datetime",
"displayFormat": "HH:MM",
"required": false,
...
},
...
],
...
}
],
}

When the user selects a time, for example "06:00”, to update the alert setting, "v2/notifyPluginAlarmUpdate" is sent out. The "value" in the update follows the format of "displayFormat": "HH:MM".

alarm-display-type-datetime-exec

See the JSON example below:

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "datetimeParam",
"value": "06:00"
}
...
]
...
}
...
]
}

"displayType":"switch" in "alarms"

The switch function is used to switch between two parameters. The Alert Settings card displays a toggle button for the user to make the change, as shown below.

alarm-display-type-switch

If you set "displayType" to "switch" in "v2/notifyPluginUpdate", you must define "displayValues" as a size 2 Array, with index 0 representing false and index 1 representing true.

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "switchParam",
"displayType": "switch",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user updates the alert settings, "v2/notifyPluginAlarmUpdate" is sent out. The value in the update follows the "displayValues" defined in "v2/notifyPluginUpdate".

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "switchParam",
"value": "offValue"
}
...
]
...
}
...
]
}

"displayType":"checkbox" in "alarms"

The Alert Settings card displays a checkbox for the user to enable or disable the parameter.

alarm-display-type-checkbox

If you set "displayType" to "checkbox" in "v2/notifyPluginUpdate", you must define "displayValues" as a size 2 Array, with index 0 representing false and index 1 representing true.

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "checkboxParam",
"displayType": "checkbox",
"displayValues": [
"offValue",
"onValue"
],
"defaultValue": "offValue",
"required": false,
...
}
],
...
}
],
}

After the user updates the alert settings, "v2/notifyPluginAlarmUpdate" is sent out. The value in the update follows the "displayValues" defined in "v2/notifyPluginUpdate"

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "checkboxParam",
"value": "offValue"
}
...
]
...
}
...
]
}

"displayType":"list" in "alarms"

The list function enables the user to select a parameter from a dropdown menu on the Alert Settings card.

alarm-display-type-list

If you set "displayType" to "list" in "v2/notifyPluginUpdate", you must define "displayValues" as the Array type.

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "listParam",
"displayType": "list",
"displayValues": [
"list1",
"list2"
],
"defaultValue": "list1",
"required": false,
...
}
],
...
}
],
}

After the user updates the alert settings, "v2/notifyPluginAlarmUpdate" is sent out. The value in the update follows the "displayValues" defined in "v2/notifyPluginUpdate".

alarm-display-type-list-exec

See the JSON example below:

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "listParam",
"value": "list1"
}
...
]
...
}
...
]
}

"displayType":"temperature" in "alarms"

If you set "displayType" to "temperature", the user can enter temperature parameters in Fahrenheit or Celsius.

alarm-display-type-temperature

See the JSON example below:

v2/notifyPluginUpdate.json
{
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "temperatureParam",
"displayType": "temperature",
"required": false,
...
}
],
...
}
],
}

Please note that while the user uses the Fahrenheit or Celsius scale on the Portal, the temperature scale sent to the plugin needs to be Kelvin.

Example:

The user enters 28oC on the Alert Settings card. However, v2/notifyPluginAlarmUpdate.json shows "value":"301.15".

alarm-display-type-temperature-exec

v2/notifyPluginAlarmUpdate.json
{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlarmUpdate",
...
...
...
"alarms": [
{
"name": "alarm1",
"params": [
{
"name": "temperatureParam",
"value": "301.15"
}
...
]
...
}
...
]
}

"v2/notifyPluginAlert"

Direction: Plugin → Agent

{
"jsonrpc": "2.0",
"method": "v2/notifyPluginAlert",
"params": {
"appGUID": "...",
"moduleName": "...",
"epoch": "...",
"alarms": [
{
"name": "...",
"action": "...",
"time": "...",
"message": "..."
}, ...
]
}
}

$.params

NameTypeRequiredDescription
"appGUID"StringcheckThe GUID of the plugin.
"moduleName"StringcheckThe name of the module. The name must match the regular expression1.
"epoch"StringcheckThe current Epoch Time in seconds.
"alarms"ArraycheckA set of alarms.

$.params.alarms[*]

NameTypeRequiredDescription
"name"StringcheckThe name of the alarm. The name must match the regular expression1.
"action"Stringcheck"trigger": When the alarm has been triggered.
"resolve": When the alarm has been resolved.
"time"StringcheckThe Epoch Time in seconds of the action.
"message"StringcheckThe content to be sent through available alert channels, e.g. email.

API Error Codes

$.error

NameTypeRequiredDescription
"code"StringcheckA number that indicates the type of an occurred error.
"message"StringcheckA String that provides a short description of the error.

Example:

{
"jsonrpc": "2.0",
"error": {
"code": "-326000",
"message": "The JSON sent is not a valid Request object."
},
"id": null
}

Error Codes

CodeStatusMessage
-320000Device offlineIf agent cannot send the request to MQTT, return device offline.
-326000Invalid Request (sign error or time error)The JSON sent is not a valid Request object.
-327000Parse errorInvalid JSON was received by the server.
An error occurred on the server while parsing the JSON text.

Footnotes

  1. regular expression: ^[a-zA-Z][a-zA-Z0-9_-]*$. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

  2. regular expression: ^[0-9]+[.][0-9]+[.][0-9]+$.